//
//  LMTimeTool.h
//  LiuMuKaMeng
//
//  Created by 江湖 on 2018/6/28.
//  Copyright © 2018年 六沐. All rights reserved.
//

#import <Foundation/Foundation.h>
/** self的弱引用 */
#define WeakSelf  __weak typeof(self) weakSelf = self

typedef NS_ENUM(NSInteger, LMTimeType) {
    LMTimeNoStart = 0,//未开始
    LMTimeOngoing,//进行中
    LMTimeEnd//已结束
};
typedef NS_ENUM(NSInteger, LMTheTimeType) {
    LMTheTimeBegin = 0,//开始
    LMTheTimePause,//暂停
    LMTheTimeStop//停止
};
typedef void (^SuccessfulBlock)(LMTimeType type);
typedef void (^CycleTimeBlock)(LMTimeType type,BOOL stop,NSInteger day,NSInteger hour,NSInteger minute,NSInteger second);//每秒执行的block
@interface LMTimeTool : NSObject
@property (nonatomic,assign)NSInteger timestamp;//倒计时数值
@property (nonatomic,strong)NSTimer *timer;
@property (nonatomic,copy)SuccessfulBlock successBlock;
@property (nonatomic,copy)CycleTimeBlock cycleBlock;
/**
 单例

 @return self
 */
+ (LMTimeTool *)shareManage;

/**
  创建单例计时器
*/
- (LMTimeTool *(^)(id wself,SEL sel))initTime;

/**
 传入参数，开始时间，结束时间，系统时间
 */
- (LMTimeTool *(^)(NSString *starTime,NSString *endTime,NSString *sysTime))timeParameter;//传入参数

/**
 时间计算结果
 */
- (LMTimeTool *(^)(SuccessfulBlock successBlock))success;//计算当前时间类型成功

/**
 每秒执行后的回调
 */
- (LMTimeTool *(^)(CycleTimeBlock cycleBlock))cycle;//每秒执行

/**
 外部sel方法回调的 
 */
- (void)runTime;

/**
 设置定时器状态开始、暂停。停止
 */
-(LMTimeTool *(^)(LMTheTimeType))setTimeType;


- (LMTimeTool *(^)(void))initGcdTime;
- (void)cancelGcdTimer;
+ (void)startGcdTimer;
@end
